/* $RCSFile: ADNDynPlugintype.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynPlugintype.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:49  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:33  christian.surieux
 *   Added Log to All cs files
 */

/* Copyrights Christian Surieux 2010 */
/* Class ADNDynPlugintype */
/* Date 2010-01-06 16:10:35Z */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using CrmSdk;

namespace AddonNice.CRMWrapper
{
    public class ADNDynPlugintype : DynEntity
    {
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.plugintype)
            {}

            public override Type DynType
            { get { return typeof(ADNDynPlugintype); } }

            public override string DynTypename
            {   get{ return CrmStr.plugintype;}}

            public override DynEntity Build()
            {   return new ADNDynPlugintype();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynPlugintype(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynPlugintype(w,PrimaryFieldValue);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynPlugintype(w,PrimaryKeyValue);}
        }

        static ADNDynPlugintype(){new Ftor();} 
        
        public override bool HasOwnerProperty
        {
            get { return false; }
        }
        
        public ADNDynPlugintype() : base() { }
        
        public ADNDynPlugintype(CRMWrapperBase w,string PrimaryFieldValue)
            : base(w,CrmStr.plugintype)
        {
            if ( PrimaryFieldValue != string.Empty )
                friendlyname = PrimaryFieldValue;
        }
        
        public ADNDynPlugintype(CRMWrapperBase w,Guid CrmId) : base(w,CrmStr.plugintype,CrmId) { }
        
        public ADNDynPlugintype(CRMWrapperBase w,InternalDynamicEntity e) : base(w,CrmStr.plugintype,e,null,null) { }
        
        public ADNDynPlugintype(CRMWrapperBase w,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(w,CrmStr.plugintype,e,prop,s) { }
        
        public ADNDynPlugintype(ResetWrapperHandler fn,string PrimaryFieldValue)
            : base(fn,CrmStr.plugintype)
        {
            if ( PrimaryFieldValue != string.Empty )
                friendlyname = PrimaryFieldValue;
        }
        
        public ADNDynPlugintype(ResetWrapperHandler fn,Guid CrmId) : base(fn,CrmStr.plugintype,CrmId) { }
        
        public ADNDynPlugintype(ResetWrapperHandler fn,InternalDynamicEntity e) : base(fn,CrmStr.plugintype,e,null,null) { }
        
        public ADNDynPlugintype(ResetWrapperHandler fn,InternalDynamicEntity e,PropertyDescriptorCollection prop,InternalColumnSet s) : base(fn,CrmStr.plugintype,e,prop,s) { }

        /* Properties */

        [CrmDynAttribute(CrmStr.plugintype)]
        public Guid plugintypeid
        {
            get
            { return KeyPropertyValue(CrmStr.plugintypeid); }
            set
            { AddKeyProperty(CrmStr.plugintypeid,value); }
        }

        protected override void SetCrmIdProperty(Guid crmId)
        {
            if ( !dicProperty.ContainsKey(CrmStr.plugintypeid) || KeyPropertyValue(CrmStr.plugintypeid) != crmId )
                plugintypeid = crmId;
        }
        public override Guid PrimaryKeyGuidValue
        {
            get
            { return plugintypeid; }
            set { plugintypeid = value; }
        }
        
        public override string PrimaryFieldName
        {
            get
            { return CrmStr.friendlyname; }
            set
            {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return friendlyname;
            }
            set
            {
                friendlyname =   value;
            }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public string assemblyname
        {
            get
            { return StringPropertyValue(CrmStr.assemblyname); }
            set
            { AddStringProperty(CrmStr.assemblyname,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public string culture
        {
            get
            { return StringPropertyValue(CrmStr.culture); }
            set
            { AddStringProperty(CrmStr.culture,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public int customizationlevel
        {
            get
            { return NumberPropertyValue(CrmStr.customizationlevel); }
            set
            { AddNumberProperty(CrmStr.customizationlevel,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public string friendlyname
        {
            get
            { return StringPropertyValue(CrmStr.friendlyname); }
            set
            { AddStringProperty(CrmStr.friendlyname,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public bool isworkflowactivity
        {
            get
            { return BooleanPropertyValue(CrmStr.isworkflowactivity); }
            set
            { AddBooleanProperty(CrmStr.isworkflowactivity,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public override Guid organizationid
        {
            get
            { return LookupPropertyValue(CrmStr.organizationid); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public Guid pluginassemblyid
        {
            get
            { return LookupPropertyValue(CrmStr.pluginassemblyid); }
            set
            { AddLookupProperty(CrmStr.pluginassemblyid,CrmStr.pluginassembly,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public Guid plugintypeidunique
        {
            get
            { return UniqueIdentifierPropertyValue(CrmStr.plugintypeidunique); }
            set
            { AddUniqueIdentifierProperty(CrmStr.plugintypeidunique,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public string publickeytoken
        {
            get
            { return StringPropertyValue(CrmStr.publickeytoken); }
            set
            { AddStringProperty(CrmStr.publickeytoken,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public string typename
        {
            get
            { return StringPropertyValue(CrmStr.typename); }
            set
            { AddStringProperty(CrmStr.typename,value); }
        }

        [CrmDynAttribute(CrmStr.plugintype)]
        public string version
        {
            get
            { return StringPropertyValue(CrmStr.version); }
            set
            { AddStringProperty(CrmStr.version,value); }
        }
    }
}